package ms.jasim.console.gui;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JPanel;

import ms.jasim.console.JasimClientService;
import ms.spm.IAppContext;

import com.vlsolutions.swing.docking.DockKey;
import com.vlsolutions.swing.docking.Dockable;
import com.vlsolutions.swing.docking.DockingConstants;
import com.vlsolutions.swing.docking.DockingConstants.Split;

abstract class DefaultDockPane extends JPanel implements Dockable
{
	private static final long serialVersionUID = 1L;
	
	private DockKey key;
	protected IAppContext context;
	protected JasimClientService svcJasim;
	
	
	/**
	 * Create the panel
	 */
	public DefaultDockPane(IAppContext context) {
		super(new BorderLayout(0, 0));
		this.context = context;
		setupContext();
	}
	
	protected abstract DockKey createDocKey();
	
	protected void setupContext() {
		svcJasim = context.getService(JasimClientService.class);
	}
	
	@Override
	public Component getComponent() {
		return this;
	}

	@Override
	public DockKey getDockKey() {
		if (key == null)
			key = createDocKey();
		return key;
	}

	
	public Split getDefaultSplit() {
		return DockingConstants.SPLIT_LEFT;
	}

}
